import { createRouter,createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      redirect: "/home"
    },
    {
      path: "/home",
      // vite的组件不支持@的绝对路径写法
      component: () => import("../views/home/index.vue")
    },
    {
      path: "/message",
      component: () => import("../views/message/index.vue")
    },
    {
      path: "/favor",
      name: "Favor",
      component: () => import("../views/favor/index.vue")
    },
    {
      path: "/order",
      component: () => import("../views/order/index.vue")
    },
    {
      path: "/city",
      component: () => import("../views/city/index.vue"),
      meta: {
        hideTabBar: true
      }
    },
    {
      path: "/search",
      component: () => import("../views/search/index.vue"),
      meta: {
        hideTabBar: true
      }
    },
    {
      // vue-router 4.1.4版本以后如果使用params传递参数，必须要搭配动态路由，否则接收不到（这种方式存在刷新页面参数丢失问题）。
      path: "/detail/:houseId",
      // 如果想通过prams方式传值，必须要增加name
      name: "Detail",
      component: () => import("../views/detail/index.vue"),
      meta: {
        hideTabBar: true
      }
    },
  ]
})

export default router